package com.hjs.test.util;

import cn.hutool.crypto.digest.DigestUtil;
import com.alibaba.fastjson.JSONObject;

public class SignUtils {

    /**
     * MD5加密
     * @param paramStr
     */
    public static String encrypt(String paramStr) {
        return DigestUtil.md5Hex(paramStr.getBytes());
    }

    public static void main(String[] args) {
        //请求体，替换成接口所需的参数
        JSONObject bizData = new JSONObject();
        bizData.put("pageSize", 10);
        bizData.put("lastId", 1);

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("partnerId", "tingting");//替换为合作商id
        jsonObject.put("accessToken", "d576c3b29268e841c3071d78165a809d");//替换为有效token
        jsonObject.put("bizData", bizData.toString());//请求体

        String partnerSecret = "123456";//替换为合作商密钥

        System.out.println("【原始参数】" + jsonObject.toString());
        System.out.println("【加密结果】" + encrypt(jsonObject.toString()));
    }


}
